<?php
/**
 * Controller is the customized base controller class.
 * All controller classes for this application should extend from this base class.
 */
class Controller extends CController
{
        public $metaKeywords = 'słowa klucze';
        
        public $metaDescription = 'opis';
        
        private $sheetsLibs = array(
            'bootstrap',
            'bootstrap-responsive.min',
            'font-awesome.min',
            'jquery-ui.min',
            'jquery.ui.theme',
            'select2',
            'select2-bootstrap',
            'sb-admin-2',
            'metisMenu/metisMenu.min',
            'font-awesome.min'
        );
        
        private $sheetsCustom = array(
            'base',
        );        
        private $scriptsLibs = array(
            'jquery-1.11.1',
            'jquery-ui',
            'bootstrap',
            'jquery-mask',
            'select2.min',
            'sb-admin-2',
            'metisMenu/metisMenu.min'
        );
        
        private $scriptsCustom = array(
            'base',
        );

        public function registerDefaults() {
            $cs = Yii::app()->clientScript;
            $this->registerSheets($cs);
            $this->registerScripts($cs);
        }
        
        private function registerScripts($cs){
            foreach($this->scriptsLibs as $sL){
                $cs->registerScriptFile(Yii::app()->baseUrl . '/themes/js/libs/'.$sL.'.js');
            }
            
            foreach($this->scriptsCustom as $sC){
                $cs->registerScriptFile(Yii::app()->baseUrl . '/themes/js/custom/'.$sC.'.js');
            }
        }
        
        private function registerSheets($cs){
            foreach($this->sheetsLibs as $sL){
                $cs->registerCSSFile(Yii::app()->baseUrl . '/themes/css/libs/'.$sL.'.css');
            }
            
            foreach($this->sheetsCustom as $sC){
                $cs->registerCSSFile(Yii::app()->baseUrl . '/themes/css/custom/'.$sC.'.css');
            }
        }
}